%fieldset#filters
  %legend Filters
  #scopes
    - if resource_admin_config.actions_index.any?
      %label Predefined filters:
      %ul
        - resource_admin_config.scopes.each do |scope|
          - scope_label = "#{scope.to_s.titlecase} <span class=\"count\">(#{resource_class.send(scope).ransack(params[:q]).result.count})</span>".html_safe
          - scope_path = "#{admin_resource_path(nil,nil,@ransack_params )}&scope=#{scope}"
          - if @scopes.try(:include?, scope.to_sym) || scope.to_sym == (params[:scope].try(:to_sym) || :all)
            - li_class = 'active'
          - else
            - li_class = nil
          - @scopes
          %li{class: li_class} #{link_to scope_label, scope_path}
  - if resource_admin_config.attributes_search.any?
    #search_filters
      %label |
        Search filters (
        %a#show{ onclick: "Adminsite.showSearchForm();" }
          = @search_params.present? ? 'Edit' : 'New'
        ) |
      - if @search_params.present?
        %ul
          - @search_params.map do |q|
            - op = q.first.split('_').last
            - column = q.first.chomp("_#{op}")
            - value = q.last
            %li<
              #{column.gsub('_',' ').capitalize} |
              #{Ransack::Translate.predicate(op)}: |
              '#{value}' |
              %button{type: 'button', "data-filter-column" => column, "data-filter-value" => q.last, "data-filter-op" => op } ×
